package com.nervenets.web.controller.setting;

import com.nervenets.web.controller.TokenParams;
import com.nervenets.web.redis.domain.GlobalRule;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.math.BigDecimal;

@EqualsAndHashCode(callSuper = true)
@Data
public class GlobalRuleParams extends TokenParams {
    @ApiModelProperty(value = "默认的核销费率", required = true)
    @DecimalMin(value = "0.01", message = "核销费率最低0.01")
    @DecimalMax(value = "1", message = "核销费率最大为1")
    private BigDecimal feeOfCheck;//

    public GlobalRule toGlobalRule() {
        return new GlobalRule(
                feeOfCheck
        );
    }
}
